package com.huhu.controller;

import com.huhu.controller.base.BaseController;
import com.huhu.dto.Result;
import org.apache.commons.beanutils.converters.IntegerConverter;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by xuyi on 2016/9/18.
 */
@Controller
@RequestMapping("btn1Ctrl")
public class Btn1Ctrl extends BaseController {

    @RequestMapping(value = "btn1Test")
    @ResponseBody
    public Result btn1Test(Integer btnNo) {
        Result rst = new Result(1, "测试user信息通过！");

        return rst;
    }


    @RequestMapping(value = "btn1TestRememberMe")
    @ResponseBody
    public Result btn1TestRememberMe() {
        Result rst = new Result(1, "测试RememberMe功能,可是没有成功！");

        Integer userId = (Integer)SecurityUtils.getSubject().getSession().getAttribute("userId");

        if (userId != null) {
            rst.setContent("测试RememberMe功能,成功！userId为：" + userId);
        }

        return rst;
    }
}
